package com.forezp.thinking.chapter18.nio;

import java.nio.ByteBuffer;
import java.nio.IntBuffer;

/**
 * Created by forezp on 2017/12/11.
 */
public class IntBufferDemo {

    private final static int BSIZE=1024;
    public static void main(String[] args) {
        ByteBuffer bb=ByteBuffer.allocate(BSIZE);
        IntBuffer ib=bb.asIntBuffer();
        ib.put(new int[]{1,2,34,4555,566});
        ib.flip();//准备写
        while (ib.hasRemaining()){
            int i=ib.get();
            System.out.println(i);
        }
    }
}
